<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\ckeditor\CKEditor;
use kartik\file\FileInput;
use yii\helpers\Url;
use backend\components\widgets\UploadSingleFileInput;


/* @var $this yii\web\View */
/* @var $model backend\models\Article */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="article-form">

    <?php $form = ActiveForm::begin([
        'enableClientValidation'=>true,
        'options' => [
            'enctype' => 'multipart/form-data' //文件上传时添加该编码
        ],
    ]) ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'url')->widget(UploadSingleFileInput::className(),[
        'pluginOptions'=>[
//            'allowedFileTypes' => ['object'],
        ],
    ]);
    ?>
    <?= $form->field($model, 'sort')->textInput() ?>

    <?= $form->field($model, 'link')->widget(CKEditor::className(), [
        'options' => ['rows' => 6],
//        'preset' => 'standard'
    ]) ?>


    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '保存' : '保存', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end() ?>

</div>



